﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Drawing.Drawing2D;

namespace UMLDesigner
{
    partial class MainWindow : Form
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        public void OnMouseMoveEventHandler(object sender, MouseEventArgs e)
        {
            Control c = (Control)sender;
            Console.WriteLine(c);
        }

        public void OnMouseDownEventHandler(object sender, MouseEventArgs e)
        {
            Control c = (Control)sender;
            Console.WriteLine(c);
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            ClassView clase = new ClassView(100, 100);
            WindowsManager.AddClass(clase);
            mainPanel.Panel1.Controls.Add(clase.GetControl());
        }

        public FormControl GetControlFormulario()
        {
            return formControl;
        }

        public void PaintRelation(RelationView rel)
        {
            Graphics g = mainPanel.Panel1.CreateGraphics();
            g.SmoothingMode = SmoothingMode.AntiAlias;
            rel.Paint(g);
            g.Dispose();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Escape)
            {
                WindowsManager.DeselectClass();
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        private void btnExportToImage_Click(object sender, EventArgs e)
        {

        }

        private void btnAddRelation_Click(object sender, EventArgs e)
        {
            RelationView rel = new RelationView();
            WindowsManager.SetRelationToCreate(rel);
        }

    }
}
